package com.huaxin.hxmodulesystem.controller;

import com.huaxin.hxmodulesystem.dto.ResponseResult;
import com.huaxin.hxmodulesystem.models.SysNationalAll;
import com.huaxin.hxmodulesystem.service.SysNationalAllService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Tag(name = "行政区划接口")
@RestController
@RequiredArgsConstructor
@RequestMapping("/v1/sys/national")
public class SysNationalAllController {
    private final SysNationalAllService sysNationalAllService;

    // 根据区域编码查询下级区域
    @Operation(summary = "根据区域编码查询下级区域", description = "根据区域编码查询下级区域")
    @GetMapping("/queryNationalListByCode")
    public ResponseResult<List<SysNationalAll>> queryNationalListByCode(String code) {
        return sysNationalAllService.queryNationalListByCode(code);
    }

    // 根据区域名称查询区域
    @Operation(summary = "根据区域名称查询区域", description = "根据区域名称查询区域")
    @GetMapping("/queryNationalListByName")
    public ResponseResult<List<SysNationalAll>> queryNationalListByName(String name) {
        return sysNationalAllService.queryNationalListByName(name);
    }

    // 根据区域级别查询区域
    @Operation(summary = "根据区域级别查询区域", description = "根据区域级别查询区域")
    @GetMapping("/queryNationalListByLevel")
    public ResponseResult<List<SysNationalAll>> queryNationalListByLevel(Integer level) {
        return sysNationalAllService.queryNationalListByLevel(level);
    }
}
